import os

def mergetxt(fpath, savepath):
    flist = os.listdir(fpath)
    flist.sort(key=lambda x:int(x[7:-4]))
    print(flist)
    with open(savepath, mode="a+") as m:
        for f in flist:
            print("Start: ", f)
            with open(os.path.join(fpath,f)) as p:
                content = p.read()
            m.write(content)
            print("End: ", f)


if __name__ == '__main__':
    mergetxt("592", "宰执天下.txt")